﻿<%@ WebHandler Language="C#" Class="SysRose_Del" %>

using System;
using System.Web;
using System.Text;
using Newtonsoft.Json;
public class SysRose_Del : IHttpHandler, System.Web.SessionState.IReadOnlySessionState
{
    
    public void ProcessRequest (HttpContext context) {
 //检验是否登录
        OTS.Common.PageSuccess page = new OTS.Common.PageSuccess();
        if (!OTS.BaseLogin.validataModule(context, (int)OTS.enumSysRight.CustomManager))
        {
            page.success = false;
            page.msg = "非法操作！";

        }
        else
        {
            string _cusId = context.Request["cusId"];
            string _Forbid = context.Request["forbid"];
            if (null != _cusId && !"".Equals(_cusId) && OTS.Common.Help.IsNumber(_cusId) && null != _Forbid && !"".Equals(_Forbid))
            {

                OTS.BLL.CustomBLL bll = new OTS.BLL.CustomBLL();
                bool forbid = false;
                if (_Forbid == "1")
                    forbid = true;
                if (bll.Forbid(int.Parse(_cusId), forbid))
                {
                    page.success = true;
                    page.msg = "设置成功";
                }
                else
                {
                    page.success = false;
                    page.msg = "设置失败！";
                }
                 
                
            }
            else
            {
                page.success = false;
                page.msg = "参数有误！";

            }
        }

        context.Response.ContentType = "application/x-json";
        context.Response.Charset = "utf-8";
        context.Response.Write(JavaScriptConvert.SerializeObject(page));
    }
 
    public bool IsReusable {
        get {
            return false;
        }
    }

}